﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	mc:Ignorable="d"
	x:Class="FreshTexture.UserControl2D"
	x:Name="UserControl"
	d:DesignWidth="531.344" d:DesignHeight="454.824">

	<Grid x:Name="LayoutRoot">
		<ListView ItemsSource="{Binding SourceTexturePack}">
			<ListView.ItemTemplate>
				<DataTemplate >
					<WrapPanel>
						<GroupBox DataContext="{Binding MainViewModel, Source={StaticResource Locator}}">
                                    

							<Viewport3D Height="121" Width="141">
                                        <!--KAMERA-->
								<Viewport3D.Camera>
									<OrthographicCamera x:Name="_camera" LookDirection="-0.123300590205619,0.109031594952015,-0.986361534001183" Position="2,-1,6"
										Width="10">
										<OrthographicCamera.Transform>
											<Transform3DGroup>
												<RotateTransform3D>
													<RotateTransform3D.Rotation>
														<AxisAngleRotation3D x:Name="myAngleRotation" Axis="0 1 0" />
													</RotateTransform3D.Rotation>
												</RotateTransform3D>
											</Transform3DGroup>
										</OrthographicCamera.Transform>
									</OrthographicCamera>
								</Viewport3D.Camera>

								<ModelVisual3D>
									<ModelVisual3D.Content>
										<Model3DGroup>
                                                    <!--FACE #1-->
											<GeometryModel3D x:Name="FaceBottom">
												<GeometryModel3D.Transform>
													<Transform3DGroup>
														<TranslateTransform3D OffsetZ="0" OffsetX="0" OffsetY="0" />
														<ScaleTransform3D ScaleZ="1" ScaleY="1" ScaleX="1" />
														<RotateTransform3D d:EulerAngles="0,0,0">
															<RotateTransform3D.Rotation>
																<AxisAngleRotation3D Axis="0,1,0" Angle="0" />
															</RotateTransform3D.Rotation>
														</RotateTransform3D>
														<TranslateTransform3D OffsetZ="0" OffsetX="0" OffsetY="0" />
														<TranslateTransform3D OffsetZ="0" OffsetX="0" OffsetY="-2" />
													</Transform3DGroup>
												</GeometryModel3D.Transform>
												<GeometryModel3D.Geometry>
													<MeshGeometry3D Positions="-1,-1,1 1,-1,1 1,1,1 -1,1,1"
														TriangleIndices="0  1  2     2  3  0" TextureCoordinates="0,1 1,1 1,0 0,0" />
												</GeometryModel3D.Geometry>
												<GeometryModel3D.Material>
													<DiffuseMaterial>
														<DiffuseMaterial.Brush>
															<ImageBrush ImageSource="{Binding SourceTexturePack/FaceBottom}"
																Stretch="Fill" />
														</DiffuseMaterial.Brush>
													</DiffuseMaterial>
												</GeometryModel3D.Material>
											</GeometryModel3D>

                                                    <!--FACE #2-->
											<GeometryModel3D x:Name="FaceFront">
												<GeometryModel3D.Geometry>
													<MeshGeometry3D Positions="-1,-1,1 1,-1,1 1,1,1 -1,1,1"
														TriangleIndices="0  1  2     2  3  0" TextureCoordinates="0,1 1,1 1,0 0,0" />
												</GeometryModel3D.Geometry>
												<GeometryModel3D.Material>
													<DiffuseMaterial>
														<DiffuseMaterial.Brush>
															<ImageBrush ImageSource="{Binding SourceTexturePack/FaceFront}"
																Stretch="Fill" />
														</DiffuseMaterial.Brush>
													</DiffuseMaterial>
												</GeometryModel3D.Material>
											</GeometryModel3D>

                                                    <!--FACE #3-->
											<GeometryModel3D x:Name="FaceRight">
												<GeometryModel3D.Transform>
													<Transform3DGroup>
														<TranslateTransform3D OffsetZ="0" OffsetX="0" OffsetY="0" />
														<ScaleTransform3D ScaleZ="1" ScaleY="1" ScaleX="1" />
														<RotateTransform3D d:EulerAngles="0,0,0">
															<RotateTransform3D.Rotation>
																<AxisAngleRotation3D Axis="0,1,0" Angle="0" />
															</RotateTransform3D.Rotation>
														</RotateTransform3D>
														<TranslateTransform3D OffsetZ="0" OffsetX="0" OffsetY="0" />
														<TranslateTransform3D OffsetZ="0" OffsetX="2" OffsetY="0" />
													</Transform3DGroup>
												</GeometryModel3D.Transform>
												<GeometryModel3D.Geometry>
													<MeshGeometry3D Positions="-1,-1,1 1,-1,1 1,1,1 -1,1,1"
														TriangleIndices="0  1  2     2  3  0" TextureCoordinates="0,1 1,1 1,0 0,0" />
												</GeometryModel3D.Geometry>
												<GeometryModel3D.Material>
													<DiffuseMaterial>
														<DiffuseMaterial.Brush>
															<ImageBrush ImageSource="{Binding SourceTexturePack/FaceRight}"
																Stretch="Fill" />
														</DiffuseMaterial.Brush>
													</DiffuseMaterial>
												</GeometryModel3D.Material>
											</GeometryModel3D>

                                                    <!--FACE #4-->
											<GeometryModel3D x:Name="FaceTop">
												<GeometryModel3D.Transform>
													<Transform3DGroup>
														<TranslateTransform3D OffsetZ="0" OffsetX="0" OffsetY="0" />
														<ScaleTransform3D ScaleZ="1" ScaleY="1" ScaleX="1" />
														<RotateTransform3D d:EulerAngles="0,0,0">
															<RotateTransform3D.Rotation>
																<AxisAngleRotation3D Axis="0,1,0" Angle="0" />
															</RotateTransform3D.Rotation>
														</RotateTransform3D>
														<TranslateTransform3D OffsetZ="0" OffsetX="0" OffsetY="0" />
														<TranslateTransform3D OffsetZ="0" OffsetX="0" OffsetY="2" />
													</Transform3DGroup>
												</GeometryModel3D.Transform>
												<GeometryModel3D.Geometry>
													<MeshGeometry3D Positions="-1,-1,1 1,-1,1 1,1,1 -1,1,1"
														TriangleIndices="0  1  2     2  3  0" TextureCoordinates="0,0 0,1 1,1 1,0" />
												</GeometryModel3D.Geometry>
												<GeometryModel3D.Material>
													<DiffuseMaterial>
														<DiffuseMaterial.Brush>
															<ImageBrush ImageSource="{Binding SourceTexturePack/FaceTop}"
																Stretch="Fill" />
														</DiffuseMaterial.Brush>
													</DiffuseMaterial>
												</GeometryModel3D.Material>
											</GeometryModel3D>

                                                    <!--FACE #5-->
											<GeometryModel3D x:Name="FaceLeft">
												<GeometryModel3D.Transform>
													<Transform3DGroup>
														<TranslateTransform3D OffsetZ="0" OffsetX="0" OffsetY="0" />
														<ScaleTransform3D ScaleZ="1" ScaleY="1" ScaleX="1" />
														<RotateTransform3D d:EulerAngles="0,0,90">
															<RotateTransform3D.Rotation>
																<AxisAngleRotation3D Axis="0,0,1" Angle="90" />
															</RotateTransform3D.Rotation>
														</RotateTransform3D>
														<TranslateTransform3D OffsetZ="0" OffsetX="0" OffsetY="0" />
														<TranslateTransform3D OffsetZ="0" OffsetX="-2" OffsetY="0" />
													</Transform3DGroup>
												</GeometryModel3D.Transform>
												<GeometryModel3D.Geometry>
													<MeshGeometry3D Positions="-1,-1,1 1,-1,1 1,1,1 -1,1,1"
														TriangleIndices="0  1  2     2  3  0" TextureCoordinates="1,1 1,0 0,0 0,1" />
												</GeometryModel3D.Geometry>
												<GeometryModel3D.Material>
													<DiffuseMaterial>
														<DiffuseMaterial.Brush>
															<ImageBrush ImageSource="{Binding SourceTexturePack/FaceLeft}"
																Stretch="Fill" />
														</DiffuseMaterial.Brush>
													</DiffuseMaterial>
												</GeometryModel3D.Material>
											</GeometryModel3D>

                                                    <!--FACE #6-->
											<GeometryModel3D x:Name="FaceBack">
												<GeometryModel3D.Transform>
													<Transform3DGroup>
														<TranslateTransform3D OffsetZ="0" OffsetX="0" OffsetY="0" />
														<ScaleTransform3D ScaleZ="1" ScaleY="1" ScaleX="1" />
														<RotateTransform3D d:EulerAngles="0,0,90">
															<RotateTransform3D.Rotation>
																<AxisAngleRotation3D Axis="0,0,1" Angle="90" />
															</RotateTransform3D.Rotation>
														</RotateTransform3D>
														<TranslateTransform3D OffsetZ="0" OffsetX="0" OffsetY="0" />
														<TranslateTransform3D OffsetZ="0" OffsetX="4" />
													</Transform3DGroup>
												</GeometryModel3D.Transform>
												<GeometryModel3D.Geometry>
													<MeshGeometry3D Positions="-1,-1,1 1,-1,1 1,1,1 -1,1,1"
														TriangleIndices="0  1  2     2  3  0" TextureCoordinates="1,1 1,0 0,0 0,1" />
												</GeometryModel3D.Geometry>
												<GeometryModel3D.Material>
													<DiffuseMaterial>
														<DiffuseMaterial.Brush>
															<ImageBrush ImageSource="{Binding SourceTexturePack/FaceBack}"
																Stretch="Fill" />
														</DiffuseMaterial.Brush>
													</DiffuseMaterial>
												</GeometryModel3D.Material>
											</GeometryModel3D>
											<AmbientLight Color="White" />
											<DirectionalLight Color="White" Direction="1,-2,-3" />
											<DirectionalLight Color="White" Direction="-1,2,3" />
										</Model3DGroup>
									</ModelVisual3D.Content>
								</ModelVisual3D>
							</Viewport3D>
						</GroupBox>
						<Label Content="{Binding IsSelected}" />
						<CheckBox IsChecked="{Binding IsSelected}" />
					</WrapPanel>
                                
				</DataTemplate>
			</ListView.ItemTemplate>
		</ListView>
	</Grid>
</UserControl>